<?php

/*
|--------------------------------------------------------------------------
| Admin Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

Route::get('/', 'AdminController@login');
Route::get('login', 'Auth\LoginController@showLoginForm');
Route::post('login', 'Auth\LoginController@login');
Route::get('logout', 'Auth\LoginController@logout');

// 陈玉琦，添加后台用户
// Route::get('create', 'AdminController@create'); // 显示创建表单
// Route::post('store', 'AdminController@store'); // 提交表单
// Route::get('update/{id}', 'AdminController@update'); // 修改密码


// 陈玉琦，测试
Route::get('test', 'TestController@index');



Route::group(['middleware' => ['web', 'auth:admin']], function () {
    Route::get('dashboard', ['as' => 'dashboard.index', 'uses' => 'DashboardController@index']);

    // 后台管理员
    Route::get('admin/list', 'AdminController@lists');
    Route::resource('admin', 'AdminController', ['except' => 'show']);

    // 参与者
    Route::get('participant/list', 'ParticipantController@lists');
    Route::resource('participant', 'ParticipantController', ['except' => 'show']);
    

    // 用户
    Route::get('user/list', 'UserController@lists');
    // 显示用户的活动和调查的列表页面
    Route::get('user/activitySurveyList/{id}', 'UserController@activitySurveyList');
    // 用户活动列表
    Route::get('user/activity/{id}', 'UserController@activityList');// id 是 user_id
    // 某一个活动
    Route::get('user/activity/one/{id}', 'UserController@activityDetail');// id 是 activity_id
    // 用户调查列表
    Route::get('user/survey/{id}', 'UserController@surveyList');// id 是 user_id
    // 某一个调查
    Route::get('user/survey/one/{id}', 'UserController@surveyDetail');// id 是 survey_id
    Route::resource('user', 'UserController');

    // 剧本
    Route::get('play/list', 'Play\PlayController@lists');
    Route::resource('play', 'Play\PlayController', ['except' => 'show']);

    // 剧本分类
    Route::get('playCategory/list', 'Play\CategoryController@lists');
    Route::resource('playCategory', 'Play\CategoryController', ['except' => 'show']);

    // 剧本类型
    Route::get('playType/list', 'Play\TypeController@lists');
    Route::resource('playType', 'Play\TypeController', ['except' => 'show']);

    // 相册类型
    Route::get('albumType/list', 'AlbumTypeController@lists');
    Route::resource('albumType', 'AlbumTypeController', ['except' => 'show']);

    // 游戏类型
    Route::get('gameType/list', 'GameTypeController@lists');
    Route::resource('gameType', 'GameTypeController', ['except' => 'show']);

    // 抽奖奖品等级
    Route::get('awardLevel/list', 'AwardLevelController@lists');
    Route::resource('awardLevel', 'AwardLevelController', ['except' => 'show']);

    // 动画
    Route::get('animation/list', 'AnimationController@lists');
    Route::resource('animation', 'AnimationController', ['except' => 'show']);
});

Menu::make('AdminNavigation', function ($menu) {
    $menu->raw('', ['class' => 'header']);

    $menu->add('<span>仪表盘</span>', ['route' => 'admin::dashboard.index'])
        ->prepend('<i class="fa fa-th"></i>')
        ->append('<span class="pull-right-container"></span>');


    $menu->add('<span>用户管理</span>', '#', ['class' => 'treeview'])->id('userManager')
        ->prepend('<i class="fa fa-dashboard"></i>')
        ->append('<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>');

    $menu->add('<i class="fa fa-circle-o"></i>用户列表', ['route' => 'admin::user.index', 'parent' => 'userManager']);
    // $menu->add('<i class="fa fa-circle-o"></i>活动列表', ['route' => 'admin::user.activity', 'parent' => 'userManager']);
    // $menu->add('<i class="fa fa-circle-o"></i>调查列表', ['route' => 'admin::user.survey', 'parent' => 'userManager']);


    $menu->add('<span>剧本管理</span>', '#', ['class' => 'treeview'])->id('playManager')
        ->prepend('<i class="fa fa-dashboard"></i>')
        ->append('<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>');

    $menu->add('<i class="fa fa-circle-o"></i>剧本列表', ['route' => 'admin::play.index', 'parent' => 'playManager']);
    $menu->add('<i class="fa fa-circle-o"></i>剧本分类', ['route' => 'admin::playCategory.index', 'parent' => 'playManager']);
    $menu->add('<i class="fa fa-circle-o"></i>剧本类型', ['route' => 'admin::playType.index', 'parent' => 'playManager']);


    $menu->add('<span>参与者管理</span>', '#', ['class' => 'treeview'])->id('participantManager')
        ->prepend('<i class="fa fa-dashboard"></i>')
        ->append('<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>');

    $menu->add('<i class="fa fa-circle-o"></i>参与者列表', ['route' => 'admin::participant.index', 'parent' => 'participantManager']);


    $menu->add('<span>管理员管理</span>', '#', ['class' => 'treeview'])->id('adminManager')
        ->prepend('<i class="fa fa-dashboard"></i>')
        ->append('<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>');

    $menu->add('<i class="fa fa-circle-o"></i>管理员列表', ['route' => 'admin::admin.index', 'parent' => 'adminManager']);


    $menu->add('<span>相册类型管理</span>', '#', ['class' => 'treeview'])->id('AlbumTypeManager')
        ->prepend('<i class="fa fa-dashboard"></i>')
        ->append('<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>');

    $menu->add('<i class="fa fa-circle-o"></i>相册类型列表', ['route' => 'admin::albumType.index', 'parent' => 'AlbumTypeManager']);


    $menu->add('<span>游戏类型管理</span>', '#', ['class' => 'treeview'])->id('GameTypeManager')
        ->prepend('<i class="fa fa-dashboard"></i>')
        ->append('<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>');

    $menu->add('<i class="fa fa-circle-o"></i>游戏类型列表', ['route' => 'admin::gameType.index', 'parent' => 'GameTypeManager']);


    $menu->add('<span>抽奖奖品等级管理</span>', '#', ['class' => 'treeview'])->id('AwardLevelManager')
        ->prepend('<i class="fa fa-dashboard"></i>')
        ->append('<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>');

    $menu->add('<i class="fa fa-circle-o"></i>抽奖奖品等级列表', ['route' => 'admin::awardLevel.index', 'parent' => 'AwardLevelManager']);


    $menu->add('<span>动画管理</span>', '#', ['class' => 'treeview'])->id('AnimationManager')
        ->prepend('<i class="fa fa-dashboard"></i>')
        ->append('<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>');

    $menu->add('<i class="fa fa-circle-o"></i>动画列表', ['route' => 'admin::animation.index', 'parent' => 'AnimationManager']);
});
